home *** CD-ROM | disk | FTP | other *** search
Java Source | 1997-02-27 | 1.3 KB | 49 lines | [TEXT/CWIE] |
- /* SK8 © 1997 Apple Computer, Inc.
- This code is protected under the current SK8 License
- See http://sk8.research.apple.com/ for more information
- Apple Research Laboratories
- */
-
-
-
-
- public class chunkedtextvisitstate extends textvisitstate {
-
- public int mCurrentChunkIndex;
-
- //constructor
- public chunkedtextvisitstate (chunkedtext inCTC, int inCharPosition) {
- mTC = inCTC;
-
- if (inCharPosition > inCTC.stringLength())
- throw new IndexOutOfBoundsException("ChunkedText index " + inCharPosition + " out of bounds");
-
- mCurrentPosition = inCharPosition; // 1st Char of current chunk
- if (inCharPosition == 0) {
- mCurrentChunkIndex = 1;
- } else {
- int[] chunkBounds;
- int charScan = 0;
- int chunkCount;
- for (chunkCount = 1; charScan <= inCharPosition; chunkCount++){
- chunkBounds = inCTC.nextChunk(charScan + 1);
- charScan = chunkBounds[1];
- }
- mCurrentChunkIndex = chunkCount;
- }
- }
-
-
- public chunkedtextvisitstate (chunkedtext inCTC,
- int inCharPosition,
- int inChunkIndex) {
- mTC = inCTC;
-
- if (inCharPosition > inCTC.stringLength())
- throw new IndexOutOfBoundsException("ChunkedText index " + inCharPosition +" out of bounds");
-
- mCurrentPosition = inCharPosition; // 1st Char of current chunk
- mCurrentChunkIndex = inChunkIndex;
-
- }
- }